<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- https://www.nowcoder.com/discuss/445569?toCommentIpt=1 -->
    <script>
        let a = [1, 2, 3, 4, 5]
        let b = a
        a[0] = 3
        console.log(b);

        let a1 = [1, 2, 3, 4, 5]
        let b1 = a1.slice()
        a1[0] = 3
        console.log(b1);

        let a2 = [1, 2, 3, 4, 5]
        let b2 = [...a2]
        a2[0] = 3
        console.log(b2);
    </script>
</body>

</html>